package leetcode.tree;

import leetcode.tree.common.TreeNode;

import java.util.ArrayList;
import java.util.List;

/**
 * @author mazouri
 * @create 2021-05-03 18:42
 *
 *https://leetcode-cn.com/problems/binary-tree-inorder-traversal/
 */
 public class _94_inorderTraversal {
    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> list = new ArrayList<>();
        inorder(root,list);
        return list;
    }

    private void inorder(TreeNode root, List<Integer> list) {
        if (root == null){
            return;
        }

        inorder(root.left,list);
        list.add(root.val);
        inorder(root.right,list);
    }
}

